import { stringify } from 'qs';
import {request} from '../utils/request';
import { getConfig } from '../../config';
const config = getConfig();

// 获取维保单位管理列表--------------------------------------------------------------------
export async function queryMaintainList(params) {
  return request('/device/devicemaintenance/list', {
    method: 'POST',
    body: params,
  });
}


// 维保单位添加
export async function saveAddMaintain(params) {
  return request('/device/devicemaintenance/save', {
    method: 'POST',
    body: params,
  });
}

// 维保单位修改
export async function saveEditMaintain(params) {
  return request('/device/devicemaintenance/update', {
    method: 'POST',
    body: params,
  });
}

// 维保单位详情
export async function queryMaintainInfo(params) {
  if (config.isMock) {
    return request(`/device/devicemaintenance/info`, {
      method: 'POST',
      body: params,
    });
  }else{
    return request(`/device/devicemaintenance/info/${params.maintenanceId}`, {
      method: 'POST',
    });
  }
}



// 维保单位（单个）批量操作删除
export async function actionMaintainDel(params) {
  return request('/device/devicemaintenance/delete', {
    method: 'POST',
    body: params,
  });
}

// 维保服务设备清单
export async function queryMaintainServiceEquipment(params) {
  return request('/device/devicemaintenance/getDevcieInfoByMaintenanceId', {
    method: 'POST',
    body: params,
  });
}

// 维保单位导出
export async function actionMaintainExport(params) {
  return request(
    "02300007",
    {
      method: "POST",
      body: params
    },
    null,
    null,
    "download"
  );
}



// 维保单位 批量导入
export async function actionMaintainImport(params) {
  return request('02300008', {
    method: 'POST',
    body: params,
  });
}

// 维保服务设备 更换维保单位
export async function actionMaintainChange(params) {
  return request('/device/deviceinfo/move', {
    method: 'POST',
    body: params,
  });
}


// 维保单独一次性全量列表数据
export async function queryMaintainListForSelect(params) {
  return request('/device/devicemaintenance/all', {
    method: 'POST',
    body: params,
  });
}
